package com.excetop.xservlet.req.param;

/**
 * short 参数
 * @author xuZW
 *
 */
public class ShortParam extends TextParam {

	/**
	 * short 参数值
	 */
	private short shortValue;
	
	/**
	 * short 参数值数组
	 */
	private short[] shortValueArray;

	public ShortParam() {
	}
	
	public ShortParam(String name, String[] textValueArray) {
		this(name, textValueArray, null);
	}
	
	public ShortParam(String name, String[] textValueArray, String[] patternArray) {
		super(name, textValueArray, patternArray);
		setType(TYPE_SHORT);
		String[] values = getTextValueArrayWithoutSpaceCharacter();
		if(null != values && values.length > 0){
			shortValueArray = new short[values.length];
			for (int i = 0; i < shortValueArray.length; i++) {
				try { shortValueArray[i] = Short.valueOf(values[i]); }
				catch (Exception e) {}
			}
		}
		String value = getTextValueWithoutSpaceCharacter();
		if(null != value){
			try { shortValue = Short.valueOf(value); }
			catch (Exception e) {}
		}
	}
	
	public short getShortValue() {
		return shortValue;
	}

	public void setShortValue(short shortValue) {
		this.shortValue = shortValue;
	}

	public short[] getShortValueArray() {
		return shortValueArray;
	}

	public void setShortValueArray(short[] shortValueArray) {
		this.shortValueArray = shortValueArray;
	}
	
	@Override
	public boolean verifying() {
		boolean result = true;
		// TODO Auto-generated method stub
		return result;
	}
	
}
